package algorithm;

import java.util.Arrays;

public class leetcode_0455 {
    public int findContentChildren(int[] g, int[] s) {
        if(s.length==0) return 0;
        Arrays.sort(g);
        Arrays.sort(s);
        int num=0;
        int j=0;
        for(int i=0;i<s.length&&j<g.length;){
            if(s[i]>=g[j]){
                num++;
                i++;
                j++;
            }
            else{
                i++;
            }
        }
        return num;
    }
}
